package com.hongning.railway.ui.main.fragments.cadremanagement.viewmodel;

import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.hongning.railway.R;
import com.hongning.railway.app.Constant;
import com.hongning.railway.entity.resbean.ResCadreBean;
import com.hongning.railway.entity.resbean.ResKaoHeBean;
import com.hongning.railway.ui.main.cadremanager.CadreGradeFragment;
import com.hongning.railway.ui.main.cadremanager.CadreManagerFragmentViewModel;
import com.hongning.railway.ui.main.fragments.cadremanagement.CadreAssessmentViewModel;
import com.hongning.railway.ui.main.fragments.cadremanagement.CadreReslutFragment;
import com.hongning.railway.ui.main.mine.partcheck.PartCheckMainFragmentViewModel;
import com.hongning.railway.ui.main.mine.partcheck.PartCheckSecondFragment;
import com.hongning.railway.util.TimeUtils;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class CadreKaoHeItemViewModel extends ItemViewModel<CadreAssessmentViewModel> {
    public ObservableField<String> name =new ObservableField<>();
    public ObservableField<String> time =new ObservableField<>();
    public ObservableField<String> statu =new ObservableField<>();
    public ObservableInt statuColor = new ObservableInt();
    ResCadreBean data;
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putParcelable(Constant.EXTRA_DATA,data);
            viewModel.startContainerActivity(CadreReslutFragment.class.getCanonicalName(),bundle);
        }
    });
    public CadreKaoHeItemViewModel(@NonNull CadreAssessmentViewModel viewModel, ResCadreBean resCadreBean) {
        super(viewModel);
        this.data=resCadreBean;
        name.set(resCadreBean.getCadretestname());
        String timeinfo = "考核时间："+ TimeUtils.getFormatTime(resCadreBean.getCreateTime())+"-"+TimeUtils.getFormatTime(resCadreBean.getCadreteststoptime());
        time.set(timeinfo);
    }
}
